.TH hal_type_t "3hal" "2006-10-12" "LinuxCNC Documentation" "HAL"
.SH NAME
hal_type_t \- typedefs for HAL datatypes
.SH DESRCIPTION
.TP
typedef ... \fBhal_bool;
A type which may have a value of 0 or nonzero.
.TP
typedef ... \fBhal_bit_t;
A volatile type which may have a value of 0 or nonzero.
.TP
typedef ... \fBhal_s32_t\fR;
A volatile type which may have a value from \-2147483648 to 2147483647.
.TP
typedef ... \fBhal_u32_t\fR;
A volatile type which may have a value from 0 to 4294967295.
.TP
typedef ... \fBhal_port_t\fR;
A volatile handle to a port object. Used with hal_port* functions.
.TP
typedef ... \fBhal_float_t\fR;
A volatile floating-point type, which typically has the same precision and range
as the C type \fBdouble\fR.
.TP
typedef ... \fBreal_t\fR;
A nonvolatile floating-point type with at least as much precision as
\fBhal_float_t\fR.
.TP
typedef ... \fBireal_t\fR;
A nonvolatile unsigned integral type the same size as \fBhal_float_t\fR.
.TP
typedef enum \fBhal_type_t\fR;
.RS
.TP
\fBHAL_BIT\fR
Corresponds to the type \fBhal_bit_t\fR.
.TP
\fBHAL_FLOAT\fR
Corresponds to the type \fBhal_float_t\fR.
.TP
\fBHAL_S32\fR
Corresponds to the type \fBhal_s32_t\fR.
.TP
\fBHAL_U32\fR
Corresponds to the type \fBhal_u32_t\fR.
.RE
.SH NOTES
\fBhal_bit_t\fR is typically a typedef to an integer type whose range is larger
than just 0 and 1.  When testing the value of a \fBhal_bit_t\fR, never compare
it to 1.  Prefer one of the following:
.RS
.IP \(bu 4
if(b)
.IP \(bu 4
if(b != 0)
.RE

It is often useful to refer to a type that can represent all the values as a
hal type, but without the volatile qualifier.  The following types correspond
with the hal types:
.RS
.IP hal_bit_t 16
int

.IP hal_s32_t 16
__s32

.IP hal_u32_t 16
__u32

.IP hal_float_t 16
hal_real_t

.IP hal_port_t 16
int
.RE 

Take care not to use the types \fBs32\fR and \fBu32\fR.  These will compile in
kernel modules but not in userspace, and not for "realtime components" when
using simulated (userspace) realtime.

.SH SEE ALSO
\fBhal_pin_new(3hal)\fR, \fBhal_param_new(3hal)\fR
